import mysql.connector.pooling


class DatabaseUtils:
    __instance = None
    connection_pool = None

    def __new__(cls, pool_name, host, user, password, database):
        if cls.__instance is None:
            cls.__instance = super().__new__(cls)
            cls.connection_pool = mysql.connector.pooling.MySQLConnectionPool(
                pool_name=pool_name,
                pool_size=10,
                host=host,
                user=user,
                password=password,
                database=database
            )
        return cls.__instance

    @classmethod
    def get_connection(cls):
        return cls.connection_pool.get_connection()